<template>
	<view class="content">
		<image class="logo" src="/static/img/indexlogo.png"></image>

		<view class="information">
			<view class="in-top">
				<view style="margin-left: 3%">
					<view style="display: flex;justify-content: center;">
						<view class="head">
							<open-data type="userAvatarUrl"></open-data>
						</view>
					</view>
					<view class="name-wrap">
						<span><open-data class="name"  type="userNickName"></open-data></span>
					</view>
				</view>
				<view class="account" @click="goUrl('account/index')">
                    <text class="iconfont" style="font-size:100upx;color: #C4B18C;">&#xe8c9;</text>
                    <view class="account-text">我的账户</view>
                </view>
			</view>
			<view class="in-bottom">
				<view style="display: flex">
					<text class="iconfont" style="padding-top:10upx;font-size:50upx;color: #C4B18C">&#xe608;</text>
<!--					<image class="sincerity-icon" src="/static/logo.png"></image>-->
					<text class="sincerity-lable">我的诚e金:</text>
					<view class="sincerity-num">{{sincer||100}}</view>
				</view>
				<text class="sincerity-detail"  @click="goUrl('account/voucher')" style="">查看详情》</text>
			</view>
		</view>
		<view class="select-bui">
			<view style="margin-left: 5%" @click="goUrl('building/index')">
				<view class="select-text" style="margin-top: 40upx">选择楼盘</view>
				<view class="select-text">缴纳诚意金，享高效服务</view>
				<view class="go-select">去选择
					<text class="iconfont" style="font-size:30upx;">&#xe60e;</text>
				</view>
			</view>
			<image class="select-img" @click="goUrl('building/index')" src="/static/img/house.png"></image>
		</view>
		<view class="item-warp">
			<view class="item" v-for="i,index in item" @click="goUrl(i.url)">
				<view style="margin-left: 5%">
					<view class="select-text" style="margin-top: 36upx">{{i.lable}}</view>
					<view class="item-text">{{i.text}}
					</view>
				</view>
				<text class="iconfont" v-if="index==0"
					  style="margin:80upx 20upx 0 0;font-size:40upx;color: #101010">&#xe633;</text>
				<text class="iconfont" v-else-if="index==1"
					  style="margin:80upx 20upx 0 0;font-size:40upx;color: #101010">&#xe600;</text>
				<text class="iconfont" v-else-if="index==2"
					  style="margin:80upx 20upx 0 0;font-size:40upx;color: #101010">&#xe7d9;</text>
				<text class="iconfont" v-else-if="index==3"
					  style="margin:80upx 20upx 0 0;font-size:40upx;color: #101010">&#xe650;</text>
			</view>
		</view>
	</view>
</template>

<script>
	import API from '../../common/api.js';
	import {showDecimal} from '../../common/util.js';
	export default {
		data() {
			return {
				sincer:'--',
				item:[{
					lable:'预约看房',
					text:'提供免费接送服务',
					url:'subscribe/index',
				},{
					lable:'闲钱理财',
					text:'积少成多',
					url:'index/treasure',
				},{
					lable:'银行活动',
					text:'天天有惊喜',
					url:'index/activity',
				},{
					lable:'关于我们',
					text:'了解更多',
					url:'index/about',
				},],
				title: '工银诚e金'
			}
		},
		onLoad() {
			uni.getLocation({
				type: 'wgs84',
				success: function (res) {
					uni.setStorage({
						key: 'location',
						data: JSON.stringify({lat:res.latitude,lng:res.longitude}),
						success: function () {

						}
					});
					console.log('当前位置的经度：' + res.longitude);
					console.log('当前位置的纬度：' + res.latitude);
				}
			});
		},
		onShow(){
			if(uni.getStorageSync('token')){
				this.getSincer()
			}
		},
		methods: {
			getSincer(){
				API.bankSincer({token:uni.getStorageSync('token')}).then(res=>{
					if(res.status==200&&res.data){
						this.sincer=showDecimal(res.data.holdBalance)
					}
				})
			},
            goUrl(url){
            	if(url=='account/index'&&!uni.getStorageSync('token')){
					uni.navigateTo({
						url: '../index/accredit'
					});
            		return;
				}
            	if(url=='index/treasure'){
					uni.showModal({
						title: '提示',
						content: '敬请期待',
						showCancel: false,
					});
            		return
				}
                uni.navigateTo({
                    url: '../'+url
                });
            }
		}
	}
</script>

<style scoped>
	.content {
		/*text-align: center;*/
		/*height: 400upx;*/
		padding-bottom: 50upx;
	}

	.logo {
		height: 444upx;
		width: 100%;
	}
	.information{
		width: 94%;
		margin-left: 3%;
		height: 306upx;
		line-height: 40upx;
		border-radius: 20upx;
		box-shadow: 0 0 22upx 8upx rgba(215, 215, 215, 1);
		position: relative;
		margin-top: -50upx;
		padding-top: 10upx;
		background: white;
	}
	.in-top{
		width: 94%;
		height: 200upx;
		margin-left: 3%;
		line-height: 40upx;
		border-radius: 20upx 20upx 0 0;
		background-color: rgba(196, 177, 140, 1);
		display: flex;
		justify-content: space-between;
	}
	.name-wrap{
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		margin-top: 14upx;
		width: 200upx;
		color: white;
		text-align: center
	}
	.name{
		padding-left: 3%;
		color: rgba(255, 255, 255, 1);
		font-size: 32upx;
		text-align: center;
		font-family: PingFangSC-regular;
	}
	.head{
		width: 140upx;
		height: 140upx;
		margin-top:-40upx;
		border-radius: 200upx;
		border: 12upx solid rgba(255, 255, 255, 1);
		overflow: hidden;
	}
	.account{
		width: 162upx;
		height: 102upx;
		margin:22upx 3% 0 0;
		line-height: 40upx;
		border-radius: 8upx;
        background: white;
        padding-top:50upx;
		display: flex;
	}
	.account-text{
		font-size:28upx;
		line-height:30upx;
		color: #A2A2A2;
		width:28upx;
		margin: -36upx 0 0 8upx;
	}
	.in-bottom{
		padding:0 2% 0 3%;
		display: flex;
		justify-content: space-between;
		padding-top: 20upx;
	}
	.sincerity-icon{
		width: 52upx;
		height: 52upx;
		margin-top: 6upx;
	}
	.sincerity-lable{
		line-height: 64upx;
		font-size: 32upx;
		margin-left: 20upx;
		color: rgba(136, 136, 136, 1);
		font-size: 16px;
		font-family: PingFangSC-regular;
	}
	.sincerity-num{
		width: 224upx;
		height: 64upx;
		line-height: 64upx;
		margin-left: 20upx;
		border-radius: 138px;
		background-color: rgba(239, 239, 239, 1);
		text-align: center;
		color: rgba(196, 177, 140, 1);
		font-size: 28upx;
		font-family: PingFangSC-regular;
	}
	.sincerity-detail{
		line-height: 64upx;
		font-size: 28upx;
		color: #C4B18C;
		font-size: 28upx;
		font-family: PingFangSC-regular;
	}
	.select-bui{
		width: 94%;
		margin-left: 3%;
		margin-top: 80upx;
		height: 200upx;
		line-height: 40upx;
		border-radius: 12upx;
		border: 1px solid rgba(230, 230, 230, 1);
		display: flex;
		justify-content: space-between;
	}
	.select-text{
		color: rgba(16, 16, 16, 1);
		font-size: 34upx;
		font-family: PingFangSC-bold;
	}
	.go-select{
		margin-top: 20upx;
		color: rgba(0, 0, 0, 1);
		font-size: 28upx;
		font-family: PingFangSC-regular;
	}
	.select-img{
		margin-top: 40upx;
		height: 160upx;
		width: 200upx;
	}
	.item-warp{
		margin-top: 60upx;
		display: flex;
		padding: 0 3%;
		justify-content: space-between;
		flex-wrap: wrap;
	}
	.item{
		width: 48%;
		height: 144upx;
		margin-bottom: 40upx;
		line-height: 20px;
		border-radius: 6px;
		border: 1px solid rgba(230, 230, 230, 1);
		display: flex;
		justify-content: space-between;
	}

	.item-text{
		color: rgba(181, 181, 181, 1);
		font-size: 26upx;
		font-family: PingFangSC-regular;
	}
</style>
